package org.dromara.answerFront.controller;

import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.answer.domain.bo.AiExamsBo;
import org.dromara.answer.domain.bo.AiUserAnswersBo;
import org.dromara.answer.domain.bo.AiUserExamsBo;
import org.dromara.answer.domain.vo.AiExamsVo;
import org.dromara.answer.domain.vo.AiUserExamsVo;
import org.dromara.answerFront.service.IFrontUserExamsService;
import org.dromara.common.core.domain.R;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 试卷
 *
 * @author Lion Li
 * @date 2025-04-09
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/answer/exams")
public class FrontExamsController extends BaseController {

    private final IFrontUserExamsService userExamsService;

    /**
     * 查询试卷列表
     */
    @GetMapping("/list")
    public TableDataInfo<AiExamsVo> list(AiExamsBo bo, PageQuery pageQuery) {
        return userExamsService.queryListPaper(bo, pageQuery);
    }

    /**
     * 查询试卷详情
     *
     * @param examId 主键
     */
    @GetMapping("/detail")
    public R<AiExamsVo> getInfo(@NotNull(message = "主键不能为空")
                                     @RequestParam("examId") Long examId) {
        return R.ok(userExamsService.queryPaperById(examId));
    }

}
